<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	//创建XHR对象
	function Xhr() {
		var xhr = null;
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
			xhr=new XMLHttpRequest();
		  }
		else
		  {// code for IE6, IE5
			xhr=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		return xhr;
	}
	//ajax的核心操作
	function getText() {
		//1.创建 XMLHttpRequest 对象
		var xhr = Xhr();
		//2.与服务器建立连接并发送请求
		xhr.open("get","getText",true);
		xhr.send(null);
		//3.从服务器端获取数据前台页面接收数据
		xhr.onreadystatechange=function()
		 {
			if (xhr.readyState==4 && xhr.status==200)
			 {
				var txt = xhr.responseText;
				var objects = eval("("+txt +")");
				alert(objects.adminId);
			 }
		}
	}

</script>
</head>
<body>
	<a href="###" onclick="getText()">ajax_demo</a>
</body>
</html>